package com.blog.web.controller;

import com.blog.common.core.domain.R;
import com.blog.common.core.web.domain.AjaxResult;
import com.blog.common.core.web.page.TableDataInfo;
import com.blog.common.domain.entity.Photo;
import com.blog.web.service.PhotoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.Serializable;

/**
 * <p>
 * 照片控制器
 * </p>
 *
 * @author Valerie
 * @date 2023/3/1
 **/
@Api(tags = "照片模块")
@RestController
public class PhotoController {

    @Resource
    private PhotoService photoService;


    /**
     * 根据相册id查看照片列表
     *
     * @param albumId 相册id
     * @return {@link R<TableDataInfo<Photo>>} 照片列表
     */
    @ApiOperation(value = "根据相册id查看照片列表")
    @GetMapping("/albums/photos")
    public R<TableDataInfo<Photo>> listPhotosByAlbumId(@RequestParam(value = "albumId", required = false) Serializable albumId) {
        return R.ok(photoService.listPhotos(albumId));
    }
}
